<?php

class PostLinkManager
{
    public static function InsertLinks( $links )
    {
        $sql = "INSERT IGNORE INTO post_link (link) VALUES ";

        $links = Util::QuoteArray($links);
        foreach ($links as $link)
        {
            $sql .= "('" . $link . "'), ";
        }

        $sql = rtrim($sql, ", ");
        Core::DBConn()->Query($sql);
    }

    public static function GetAllLinks()
    {
        $sql = "SELECT link FROM post_link";
        $linksAssoc = Core::DBConn()->Query($sql)->GetAllAssoc();

        $links = array();
        foreach ( $linksAssoc as $assoc )
        {
            array_push($links, $assoc['link']);
        }

        return $links;
    }
}

?>